package org.alvin.gencode.run.code;

import lombok.extern.slf4j.Slf4j;
import org.alvin.code.jdbc.JDBCBaseDao;
import org.alvin.mini_inject.annotations.MiniComponent;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

@Slf4j
@MiniComponent
public class PrestoCodeDao extends JDBCBaseDao implements ICodeDao {
    @Override
    public List<Table> queryTables(CodeCond cond) throws SQLException {
       String sql = "show tables from " + cond.getTable_schema();
       List<String> tables = this.findCellList(sql,null,String.class);
        return null;
    }

    @Override
    public List<Field> queryFields(CodeCond cond) throws SQLException {
        String sql ="show columns from "+ cond.getTable_schema() +"."+ cond.getT_name();
        List<Map<String,Object>> list = this.queryList(sql,(Object [])null);
        // columns type extra comment
        return null;
    }
}
